using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Dal.Models.Mapping
{
    public class MEETMap : EntityTypeConfiguration<MEET>
    {
        public MEETMap()
        {
            // Primary Key
            this.HasKey(t => new { t.NUM, t.PHONE, t.CONTENT, t.STARTTIME, t.ANUM });

            // Properties
            this.Property(t => t.NUM)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.PHONE)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.CONTENT)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.STARTTIME)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ENDTIME)
                .HasMaxLength(50);

            this.Property(t => t.ANUM)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.HIT1)
                .HasMaxLength(50);

            this.Property(t => t.HIT2)
                .HasMaxLength(50);

            this.Property(t => t.HIT3)
                .HasMaxLength(50);

            this.Property(t => t.HIT4)
                .HasMaxLength(50);

            this.Property(t => t.HIT5)
                .HasMaxLength(50);

            this.Property(t => t.TYPE)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("MEET");
            this.Property(t => t.NUM).HasColumnName("NUM");
            this.Property(t => t.PHONE).HasColumnName("PHONE");
            this.Property(t => t.CONTENT).HasColumnName("CONTENT");
            this.Property(t => t.STARTTIME).HasColumnName("STARTTIME");
            this.Property(t => t.ENDTIME).HasColumnName("ENDTIME");
            this.Property(t => t.ANUM).HasColumnName("ANUM");
            this.Property(t => t.HIT1).HasColumnName("HIT1");
            this.Property(t => t.HIT2).HasColumnName("HIT2");
            this.Property(t => t.HIT3).HasColumnName("HIT3");
            this.Property(t => t.HIT4).HasColumnName("HIT4");
            this.Property(t => t.HIT5).HasColumnName("HIT5");
            this.Property(t => t.TYPE).HasColumnName("TYPE");
        }
    }
}
